class ParentClass:
    def __init__(self, name):
        self.name = name

    def greet(self):
        return f"Hello, my name is {self.name}"


class ChildClass(ParentClass):
    def __init__(self, name, age):
        # 调用父类的__init__方法
        super().__init__(name)
        self.age = age

    def greet(self):
        # 重写父类的greet方法
        return f"Hello, my name is {self.name} and I am {self.age} years old"


# 创建子类实例
child = ChildClass("A", 10)
print(child.greet())  # 输出: Hello, my name is A and I am 10 years old